package com.ssy.lingxi.open.api.entity;

import lombok.Getter;
import lombok.Setter;

import javax.persistence.*;
import java.io.Serializable;

/**
 * 用户实体类
 * @author jw.chen
 * @version 2.0.0
 * @date 2021/10/12
 */
@Getter
@Setter
@Entity
@Table(schema = "public", name = "open_api_user", uniqueConstraints = {@UniqueConstraint(columnNames="account")}, indexes = {@Index(name = "open_api_user_account_password_idx", columnList = "account,password")})
public class User implements Serializable {
    private static final long serialVersionUID = 4232657545628309550L;
    /**
     * 主键id
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE, generator="user_seq")
    @SequenceGenerator(sequenceName="open_api_user_seq", name="user_seq",allocationSize = 1)
    private Long id;

    /**
     * 账号
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String account;

    /**
     * 密码
     */
    @Column(columnDefinition = "varchar(50)", nullable = false)
    private String password;

    /**
     * 创建时间
     */
    @Column(columnDefinition = "int8", nullable = false)
    private Long createTime = System.currentTimeMillis();
}
